module.exports = {
    search: 'SELECT g.*,u.nickname FROM et_group LEFT JOIN et_user_profile u ON u.user_id = g.owner WHERE g.name like ?',
    detail: 'SELECT g.*,u.nickname FROM et_group LEFT JOIN et_user_profile u ON u.user_id = g.owner WHERE  g.id = ?',
    group_user: 'SELECT u.nickname,gu.user_id,u.avatar FROM et_group_user gu LEFT JOIN et_user_profile u ON u.id = gu.user_id WHERE gu.group_id = ?',
    has: 'SELECT 1 FROM et_group_user WHERE group_id = ? AND user_id = ?',
    add: {
        group: 'INSERT INTO et_group (name, owner,capacity,createtime) VALUES (?,?,?,?)',
        group_id: 'SELECT LAST_INSERT_ID() AS GID',
        group_user: 'INSERT INTO et_group_user (group_id, user_id) VALUES (?,?)'
    },
    join: {
        group: 'UPDATE et_group SET size = size + 1',
        group_user: 'INSERT INTO et_group_user (group_id, user_id) VALUES (?, ?)',
    }
}